#-*- coding: utf-8 -*-

class Events():
    listeners = {}

    def add_listener(self, name, evtkey, callback, args = []):
        self.listeners[name] = (evtkey,callback, args)

    def send_event(self,ename, args = []):
        for e, cb, ar in self.listeners.values():
            if e == ename:
                cb(*(ar+args))

    def remove_listener(self,name):
        if self.has_key(name):
            del self.listeners[name]
